<?php
namespace app\admin\controller;

use cmf\controller\AdminBaseController;
use think\Db;

class TemplateController extends AdminBaseController
{
  public function _initialize()
  {
  }
  
  /**模板列表*/
  public function index ()
  {
  
    $where   = [];
    $request = input('request.');
    
    if (!empty($request['title'])) {
      $title = $request['title'];
      $where['title'] = array('LIKE', "%$title%");
    }
    
    $list = Db::connect('aizuoyou')
      ->name('game_template')
      ->where($where)
      ->order("usenum DESC")
      ->paginate(10);
    
    // 获取分页显示
    $page = $list->render();
    $this->assign('list', $list);
    $this->assign('page', $page);
    // 渲染模板输出
    return $this->fetch();
  }
}